/**
 * Created by LENOVO 2.0 on 2016/9/12.
 */


$(function() {
	//"use strict";

	//重置使图片占满整个屏幕
	function o() {
		n = $(window).innerHeight(), $(".intro").css("height", n)
	}
	var n;
	o(), $(window).resize(function() {
			o();
		}),

		//导航浮动
		$(window).scroll(function() {
			if ($(this).scrollTop() > n - 20) {
				$('.navbar').addClass('navbar-fixed-top');
			} else {
				$('.navbar').removeClass('navbar-fixed-top');
			}
		}),


		//页面滚动效果
		$('.intro-text a,.next a').click(function() {
			var a = $(this),
				target = a.attr('href');
			return $('html,body').animate({
				scrollTop: $(target).offset().top - 60
			}, 1000), !1
		}),


		$('#navigation,.navbar-header').find('a').on('click', function(e) {
			var n = $(this),
				id = n.attr('href');
			return $('html,body').animate({
				scrollTop: $(id).offset().top
			}, 1000), !1
		}),

		//手机端导航菜单伸缩效果
		$('#navbar ul li a').click(function(e) {
			$('.navbar-collapse').collapse('hide')
		})




});

// 作品图片展示的大小，个数，动画效果
(function($) {
	"use strict";
	var $container = $('#work-item'),
		colWidth = function() {
			var w = $container.width(),
				columnNum = 1,
				columnWidth = 0;
			if (w > 960) {
				columnNum = 4;
			} else if (w > 640) {
				columnNum = 3;
			} else if (w > 360) {
				columnNum = 2;
			}
			columnWidth = Math.floor(w / columnNum);
			$container.find('.item').each(function() {
				var $item = $(this),
					multiplier_w = $item.attr('class').match(/item-w(\d)/),
					multiplier_h = $item.attr('class').match(/item-h(\d)/),
					width = multiplier_w ? columnWidth * multiplier_w[1] : columnWidth,
					height = multiplier_h ? columnWidth * multiplier_h[1] * 0.7 - 10 : columnWidth * 0.7 - 10;
				$item.css({
					width: width,
					height: height
				});
			});
			return columnWidth;
		},
		isotope = function() {
			$container.isotope({

				resizable: true,
				itemSelector: '.item',
				masonry: {
					columnWidth: colWidth(),
					gutterWidth: 10
				}
			});
		};
	isotope();
	$(window).smartresize(isotope);
	$('.portFilter a').click(function() {
		$('.portFilter .current').removeClass('current');
		$(this).addClass('current');
		var selector = $(this).attr('data-filter');
		$container.isotope({
			filter: selector,
			animationOptions: {
				duration: 750,
				easing: 'linear',
				queue: false
			}
		});
		return false;
	});
}(jQuery));


// 基于准备好的dom，初始化echarts 树图实例
$(function() {
	var myChart = echarts.init(document.getElementById('myChart1'));
	myChart.showLoading();
	var data = {
		"name": "能力",
		"children": [{
				"name": "文件存储",
				"children": [{
					"name": "minio"
				},{
					"name": "oss"
				},{
					"name": "本地存储"
				}]
			},{
				"name": "软件",
				"children": [{
					"name": "Eclipse"
				}, {
					"name": "STS"
				}, {
					"name": "IDEA"
				}, {
					"name": "HbuilderX"
				}, {
					"name": "Navicat"
				}, {
					"name": "StarUML"
				}, {
					"name": "VS Code"
				}, {
					"name": "PS"
				}]
			},
			{
				"name": "服务器",
				"children": [{
					"name": "应用",
					"children": [{
						"name": "Apache"
					}, {
						"name": "Tomcat"
					}, {
						"name": "Nginx"
					}]
				}, {
					"name": "系统",
					"children": [{
						"name": "window service"
					}, {
						"name": "linux"
					}, {
						"name": "银河麒麟"
					}]
				}]
			},
			{
				"name": "工程管理",
				"children": [{
					"name": "Maven"
				}, {
					"name": "Gradle"
				}, {
					"name": "本地化"
				}]
			},
			{
				"name": "微服务",
				"children": [{
					"name": "Zookeeper"
				}, {
					"name": "Eruka"
				}, {
					"name": "Consul"
				}, {
					"name": "Nacos"
				}]
			},
			{
				"name": "版本控制",
				"children": [{
					"name": "Git"
				}, {
					"name": "SVN"
				}]
			},
			{
				"name": "框架",
				"children": [{
					"name": "安全",
					"children": [{
						"name": "自定义基于SpringMVC的控制器、过滤器、监听器实现安全校验"
					}, {
						"name": "Shiro"
					}, {
						"name": "Spring Security"
					}]
				}, {
					"name": "ORM",
					"children": [{
						"name": "Mybatis"
					}, {
						"name": "Hibernate"
					}, {
						"name": "SpringDataJPA"
					}]
				}, {
					"name": "前端",
					"children": [{
						"name": "Vue"
					}, {
						"name": "EasyUl"
					}, {
						"name": "Bootstrap"
					}, {
						"name": "LayUI"
					}, {
						"name": "Element"
					}, {
						"name": "MUI"
					}]
				}]
			}, {
				"name": "数据库",
				"children": [{
					"name": "关系型",
					"children": [{
						"name": "MySQL"
					}, {
						"name": "Oracle"
					}, {
						"name": "阿里rds"
					}, {
						"name": "达梦"
					}, {
						"name": "金仓"
					}]
				}, {
					"name": "非关系型",
					"children": [{
						"name": "MongoDB"
					}, {
						"name": "Redis"
					}, {
						"name": "HBase"
					}]
				}]
			}, {
				"name": "中间件",
				"children": [{
					"name": "消息",
					"children": [{
						"name": "RabbitMQ"
					}, {
						"name": "ActiveMQ"
					},{
                        "name": "Kafka"
                    },{
                        "name": "RocketMQ"
                    },{
                        "name": "ZeroMQ"
                    },{
                        "name": "Pulsar"
                    }]
				}, {
					"name": "数据库",
					"children": [{
						"name": "MyCat"
					}]
				}, {
					"name": "事务",
					"children": [{
						"name": "Seata"
					}]
				}, {
					"name": "推送",
					"children": [{
						"name": "MPush"
					}, {
						"name": "GPush"
					}]
				}]
			}, {
				"name": "引擎",
				"children": [{
					"name": "搜索",
					"children": [{
						"name": "Elastisearch"
					}, {
						"name": "Solr"
					}]
				}, {
					"name": "对象服务",
					"children": [{
						"name": "Hprose"
					}]
				}]
			}, {
				"name": "脚手架",
				"children": [{
					"name": "SpringbootPlus"
				}, {
					"name": "SpringCloudPlus"
				}, {
					"name": "VueElmentAdmin"
				}]
			}, {
				"name": "流程",
				"children": [{
					"name": "Jenkins"
				}, {
					"name": "禅道"
				}]
			}, {
				"name": "大数据",
				"children": [{
					"name": "Hadoop"
				}, {
					"name": "Flink"
				}, {
					"name": "Spark"
				}]
			}, {
				"name": "基础",
				"children": [{
					"name": "Java"
				}, {
					"name": "HTML"
				}, {
					"name": "CSS"
				}, {
					"name": "JavaScript"
				}, {
					"name": "JQuery"
				}, {
					"name": "JSTL"
				}, {
					"name": "EL"
				}, {
					"name": "JSP"
				}, {
					"name": "JDBC"
				}, {
					"name": "Servlet"
				}, {
					"name": "Ajax"
				}, {
					"name": "Axios"
				}, {
					"name": "Socket"
				}, {
					"name": "WebSocket"
				}, {
					"name": "Thymeleaf"
				}]
			}
		]
	};
	myChart.hideLoading();
	myChart.setOption(option = {
		tooltip: {
			trigger: 'item',
			triggerOn: 'mousemove'
		},
		legend: {
			top: '5%',
			left: '10%',
			orient: 'vertical',
			data: [{
				name: 'power',
				icon: 'rectangle'
			}],
			borderColor: '#c23531'
		},
		series: [{
			type: 'tree',
			name: 'power',
			data: [data],
			left: '7%',
			right: '7%',
			top: '5%',
			bottom: '10%',
			symbolSize: 7,
			layout: 'radial',
			label: {
				position: 'top', //标签的位置。
				rotate: 0, //标签旋转。从 -90 度到 90 度。正值是逆时针。
				verticalAlign: 'middle', //文字垂直对齐方式，默认自动。
				align: 'left', //文字水平对齐方式，默认自动。
				fontSize: 10, //文字的字体大小
			},
			expandAndCollapse: true,
			animationDuration: 550,
			animationDurationUpdate: 750,
			initialTreeDepth: 1, //默认：2，树图初始展开的层级（深度）。根节点是第 0 层，然后是第 1 层、第 2 层，... ，直到叶子节点
		}]
	});
});

// 基于准备好的dom，初始化echarts 雷达图实例
function radarChartFunction() {
	var radarChart = echarts.init(document.getElementById('radarChart'));
	let data = [10000, 12000, 7000, 6500, 9500, 7000, 9000, 8000, 9500]
	let indicator = [{
			name: '系统架构',
			max: 13000
		},{
			name: 'Java后端',
			max: 13000
		},
		{
			name: '产品设计',
			max: 13000
		},
		{
			name: '渗透安全',
			max: 13000
		},
		{
			name: '项目管理',
			max: 13000
		},
		{
			name: '前端开发',
			max: 13000
		},
		{
			name: '测试督质',
			max: 13000
		},
		{
			name: '运维部署',
			max: 13000
		},
		{
			name: '培训讲演',
			max: 13000
		}
	]

	option = {

		radar: {
			center: ['50%', '50%'],
			radius: '75%',
			name: {
				formatter: function(name, indicator) {
					let arr;
					arr = [
						'{a|' + name + '}'
					]
					return arr.join('\n')
				},
				textStyle: {
					rich: { //根据文字的组设置格式
						a: {
							color: '#25476F',
							fontSize: 16,
							fontWeight: 600,
							fontFamily: 'Source Han Sans CN',
						},
						// b:{
						//     fontSize:14,
						//     verticalAlign:'top',
						//     width:57,
						//     color:'#8E88FE',
						//     fontWeight:600,
						//     align:'center'
						// },
					}

				}
			},
			nameGap: 0,
			indicator: indicator,
			splitLine: {
				show: false

			},
			splitArea: {
				show: false
			},
			axisLine: {
				show: false
			}
		},
		series: [{
				// name: '家庭融合包',
				type: 'radar',
				data: [data],
				// value:14,
				label: {
					show: true,
					formatter: function(params) {
						console.log(params)
						return params.value + 'η';
					},
					color: '#666666',
					position:[-20,-10,-10,-10],
					align: 'left',
					distance: 3,
				},
				symbolSize: [6, 6],
				lineStyle: { //边缘颜色
					width: 0
				},
				itemStyle: {
					borderWidth: 1,
					color: '#fff',
					borderColor: '#F2F063',
				},
				areaStyle: {
					color: '#7D77F1',
					opacity: 0.6
				}
			},
			{
				type: 'radar',
				data: [
					[13000, 13000, 13000,13000,13000, 13000,13000,13000,13000],
				],
				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},
			
				areaStyle: {
					color: '#4175F5',
					opacity: 0.06
				}
			},
			{
				type: 'radar',
				data: [
					[12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000, 12000],
				],
				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},
			
				areaStyle: {
					color: '#4175F5',
					opacity: 0.06
				}
			},
			{
				type: 'radar',
				data: [
					[11000, 11000, 11000, 11000, 11000, 11000, 11000, 11000, 11000],
				],
				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},
			
				areaStyle: {
					color: '#4175F5',
					opacity: 0.06
				}
			},
			{
				type: 'radar',
				data: [
					[10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000],
				],
				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.06
				}
			},
			{
				type: 'radar',
				data: [
					[9000, 9000, 9000, 9000, 9000, 9000, 9000, 9000, 9000],
				],

				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#2C72C8'
				},

				areaStyle: {
					color: '#2C72C8',
					opacity: 0.12
				}
			},
			{
				type: 'radar',
				data: [
					[8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000]
				],

				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.18
				}
			},
			{
				type: 'radar',
				data: [
					[7000, 7000, 7000, 7000, 7000, 7000, 7000, 7000, 7000]
				],

				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.19
				}
			},
			{
				type: 'radar',
				data: [
					[6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000, 6000],
				],

				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.17
				}
			},
			{
				type: 'radar',
				data: [
					[5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000, 5000],
				],
				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.16
				}
			},
			{
				type: 'radar',
				data: [
					[400, 400, 400, 400, 400, 400, 400, 400, 400],
				],

				symbol: 'none',
				lineStyle: {
					width: 0
				},
				itemStyle: {
					color: '#4175F5'
				},

				areaStyle: {
					color: '#4175F5',
					opacity: 0.13
				}
			},
		]
	};
	radarChart.setOption(option);

}
radarChartFunction();
// 基于准备好的dom，初始化echarts 词云图实例
$(function() {
	var JosnList = [{
			name: "链猫商城",
			value: "1",
		},
		{
			name: "智慧物联网平台",
			value: "2",
		},
		{
			name: "天元财务管理系统",
			value: "3",
		},
		{
			name: "安徽无线电协会会员考试系统",
			value: "4",
		},
		{
			name: "诺基亚物流交付系统",
			value: "5",
		}, {
			name: "农业门户官网系统",
			value: "6",
		}
	];
	var optionFour = {
		tooltip: {
			show: true
		},
		series: [{
			name: '项目介绍',
			type: 'wordCloud',
			sizeRange: [20, 30], //文字范围
			//文本旋转范围，文本将通过rotationStep45在[-90,90]范围内随机旋转
			rotationRange: [-45, 90],
			rotationStep: 45,
			textRotation: [0, 45, 90, -45],

			//形状cardioid心形,diamond菱形,square正方形,triangle-forward指向右边的三角形,triangle-upright正三角形
			//triangle三角形，pentagon五角形，star五角星形，circle 随机
			shape: 'star',
			textStyle: {
				normal: {
					color: function() { //文字颜色的随机色
						return 'rgb(' + [
							Math.round(Math.random() * 250),
							Math.round(Math.random() * 250),
							Math.round(Math.random() * 250)
						].join(',') + ')';
					}
				},
				//悬停上去的颜色设置
				emphasis: {
					shadowBlur: 10,
					shadowColor: '#333'
				}
			},
			data: JosnList
		}]
	};
	var myChartFour = echarts.init(document.getElementById('cyt'));
	//使用制定的配置项和数据显示图表
	myChartFour.setOption(optionFour);
	myChartFour.on('click', eConsole);
});
// 词云图相应事件 
function eConsole(param) {
	if (typeof param.seriesIndex == 'undefined') {
		return;
	}
	if (param.type == 'click') {
		if (param.name == '链猫商城') {
			$('#myModal1').modal('show')
		} else if (param.name == '智慧物联网平台') {
			$('#myModal2').modal('show')
		} else if (param.name == '天元财务管理系统') {
			$('#myModal3').modal('show')
		} else if (param.name == '安徽无线电协会会员考试系统') {
			$('#myModal4').modal('show')
		} else if (param.name == '诺基亚物流交付系统') {
			$('#myModal5').modal('show')
		} else if (param.name == '农业门户官网系统') {
			$('#myModal6').modal('show')
		}
	}
}


// 个人词云图
let myChart = echarts.init(document.getElementById('wordcloud_echarts'));
	let keywords = [{"name":"微服务","value":2.64},
	                {"name":"集群","value":4.03},
	                {"name":"架构","value":24.95},
	                {"name":"中间件","value":4.04},
	                {"name":"事务","value":5.27},
	                {"name":"多线程","value":5.80},
	                {"name":"并发","value":3.09},
	                {"name":"分布式","value":6.33},
	                {"name":"隔离","value":6.33},
	                {"name":"分库分表","value":2.55},
	                {"name":"QPS","value":3.88},
	                {"name":"TPS","value":8.04},
	                {"name":"RT","value":5.87},
	                {"name":"即时通讯","value":6.97},
	                {"name":"性能监控","value":2.53},
	                {"name":"SQL优化","value":2.49},
	                {"name":"内卷","value":3.91},
	                {"name":"薪酬倒挂","value":3.25},
	                {"name":"链路拆解","value":9.93},
	                {"name":"高内聚低耦合","value":3.65}];

	var option = {
		series: [{
			type: 'wordCloud',
			sizeRange: [15, 80],
			rotationRange: [0, 0],
			rotationStep: 45,
			gridSize: 8,
			shape: 'pentagon',
			width: '100%',
			height: '100%',
			textStyle: {
				normal: {
					color: function () {
						return 'rgb(' + [
							Math.round(Math.random() * 160),
							Math.round(Math.random() * 160),
							Math.round(Math.random() * 160)
						].join(',') + ')';
					}
				}
			},
			data: keywords
		}]
	};
	// 使用刚指定的配置项和数据显示图表。
	myChart.setOption(option);
	window.addEventListener("resize", function() {
		myChart.resize();
	});